package com.winiex.datastructure;

import com.winiex.datastructure.exception.QueueEmptyException;
import com.winiex.datastructure.exception.SqQueueFullException;

/**
 * The Queue data structure interface 
 * @author winiex
 *
 */
public interface Queue<T> {
	
	/**
	 * Clear the Queue.
	 */
	void ClearQueue();
	
	/**
	 * Judge whether the Queue is empty or not.
	 * @return If empty, return true, else return false. 
	 */
	boolean QueueEmpty();
	
	/**
	 * Return the length of the Queue.
	 * @return The length of the Queue.
	 */
	int QueueLength();
	
	/**
	 * Get the Queue head.
	 * @return The Queue head.
	 */
	T GetHead();
	
	/**
	 * Get a node enqueue.
	 * @param node The node to be enqueued.
	 */
	void EnQueue(T node) throws SqQueueFullException;
	
	/**
	 * Dequeue a node.
	 * @return The node being dequeued.
	 */
	T DeQueue()throws QueueEmptyException;
	
	/**
	 * Traverse the Queue.
	 * @param t the traverse rule.
	 */
	void QueueTraverse(Traverse<T> t);
	
	interface Traverse<T> {
		
		/**
		 * Traverse process.
		 * @param t the element to be traversed.
		 */
		void traverse(T t);
		
	}
	
}
